﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using DAL;
using System.Data;

namespace BLL
{
    public class B_Hoadon
    {
        public M_Hoadon GetByPK_HoadonID(int HoadonID)
        {
            return (new D_Hoadon()).GetbyPK_HoadonID(HoadonID);
        }

        public DataTable GetAll()
        {
            return (new D_Hoadon()).GetAll();
        }

        public DataTable GetByFK_KhachID(int KhachID)
        {
            return (new D_Hoadon()).GetByFK_KhachID(KhachID);
        }
        public DataTable GetByFK_DangkyID(int DangkyID)
        {
            return (new D_Hoadon()).GetByFK_DangkyID(DangkyID);
        }

        public void Insert(M_Hoadon M_Hoadon)
        {
            (new D_Hoadon()).Insert(M_Hoadon);
        }

        public void Update(M_Hoadon M_Hoadon)
        {
            (new D_Hoadon()).Update(M_Hoadon);
        }

        public void Delete(int HoadonID)
        {
            if (HoadonID <= 0)
                throw new Exception("Không hợp lệ! Vui lòng thử lại sau!");

            new D_Hoadon().Delete(HoadonID);
        }
    }
}
